/**
 * Created by kangm_000 on 2016/12/7 0007.
 */
function getPagination(nowPage, allPages) {
    var pagination = [];
    if (allPages <= 5) {
        for (var i = 1; i <= allPages; i++) {
            pagination.push(i);
        }
        return pagination;
    }
    if (allPages - nowPage < 5) {
        for (var i = 5; i > 0; i--) {
            pagination.push(allPages - i + 1);
        }
        return pagination;
    }
    if(nowPage <= 3){
        pagination = [1,2,3];
        pagination.push(0);
        pagination.push(allPages);
    } else {
        for (var i = 3; i > 0; i--) {
            pagination.push(nowPage - i + 1);
        }
        pagination.push(0);
        pagination.push(allPages);
    }
    return pagination;
}